package com.example.harmonet.harmtorch;

public class LayerNorm implements Layer{

    @Override
    public Tensor forward(Tensor in){
        Tensor out = new Tensor(in.dim());
        int sum = 1;
        for(int i = 0; i < in.tensor().length; i++){
            sum += in.tensor()[i];
        }
        for(int i = 0; i < in.tensor().length; i++){
            out.tensor()[i] = in.tensor()[i] / sum;
        }
        return out;
    }

    @Override
    public int getParam(){
        return 0;
    }

    @Override
    public void init(float[] par){

    }
}
